import cv2 as cv
 
#选择摄像头号，一般从 0 开始
cap = cv.VideoCapture(1)
cap.set(6,cv.VideoWriter.fourcc('M','J','P','G'))
cap.set(3,1920)
cap.set(4,1080)
cap.set(5,5)
cap.set(7,5)
 
#先设置参数，然后读取参数
for i in range(47):
    print("No.={} parameter={}".format(i,cap.get(i)))

i = 0 
while True:
    ret, img = cap.read()
    # cv.imshow("input", img)
    # print(img.shape)
    # print(type(img))
    cv.imwrite("./shiping/"+ str(i) + ".bmp", img)  # 存为图像
    i += 1
# 按 ESC 键退出
    # key = cv.waitKey(10)
    # if key == 27:
    #     break

cv.destroyAllWindows()